package net.longjin.config;
import com.github.houbb.sensitive.word.bs.SensitiveWordBs;
import com.github.houbb.sensitive.word.support.allow.WordAllows;
import com.github.houbb.sensitive.word.support.deny.WordDenys;
import net.longjin.sensitiveWord.MyDdWordAllow;
import net.longjin.sensitiveWord.MyDdWordDeny;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author：何志鹏
 * @Package：net.longjin.config
 * @Project：mybatis_plus
 * @Date：2022/12/12 12:40
 * @Filename：SpringSensitiveWordConfig
 */
@Configuration
public class SpringSensitiveWordConfig {


    @Autowired
    private MyDdWordAllow myDdWordAllow;

    @Autowired
    private MyDdWordDeny myDdWordDeny;
    /**
     * 初始化引导类
     * @return 初始化引导类
     * @since 1.0.0
     */
    @Bean
    public SensitiveWordBs sensitiveWordBs() {
        SensitiveWordBs init = SensitiveWordBs.newInstance()
                .wordAllow(WordAllows.chains(WordAllows.system(), myDdWordAllow))
                .wordDeny(WordDenys.chains(WordDenys.system(), myDdWordDeny))
                .ignoreRepeat(false)
                // 各种其他配置
                .init();

        return init;
    }
}
